import { WebMapServiceImageryProvider, ArcGisMapServerImageryProvider } from 'cesium'

const addWMSImagery = (viewer, opts = {}) => {
    const imageryProvider = new WebMapServiceImageryProvider({
        url: opts.url,
        layers: opts.layers,
        parameters: {
            service: 'WMS',
            transparent: true,//背景透明
            format: 'image/png',
            // version: '1.3.0'
        },
        enablePickFeatures: false
    })
    return viewer.imageryLayers.addImageryProvider(imageryProvider)
}

const addArcGisMapServerImagery = async (viewer, opts = {}) => { 
    const imageryProvider = await ArcGisMapServerImageryProvider.fromUrl(opts.url)
    viewer.imageryLayers.addImageryProvider(imageryProvider)
}

export { addWMSImagery, addArcGisMapServerImagery }